﻿namespace EzDesk.DesktopClient.OptionsModule
{
    using EzDesk.MVVMBase;
    using EzDesk.DesktopClient.Event;
    using System.Collections.Generic;
    using EzDesk.EventAggregation;
    using EzDesk.Generic;
    using System.Collections.ObjectModel;
    using System;
    using EzDesk.DesktopClient.Model;
    using EzDesk.Generic.Collections;
    using System.Linq;
    using EzDesk.DesktopClient.MVVMEnhance;


    public class OptionsViewModel : ViewModelWithSingleContainer<IOptionsView>
    {
        public ClientConfigurationManagement ClientConfig
        {
            get
            {
                return ClientConfigurationManagement.Instance;
            }
        }

        public OptionsViewModel()
            : base()
        {
            InitViewEvent();
        }

        public void InitViewEvent()
        {
            View.OnSave += new EventHandler(View_OnSave);
        }

        void View_OnSave(object sender, EventArgs e)
        {
            ClientConfig.SaveConfiguration();
            this.View.CloseWindowView();
        }
    }
}